package com.googlecode.continuity.plugin.syntaxhighlight.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.JavaScriptObject;

/**
 * HighlightInit
 *
 * @author Peter Schmitt <aragos@aragos.de>
 */
public class HighlightInit implements EntryPoint {

  private static JavaScriptObject registered;

  /**
   * Read available languages at module load.
   */
  public native void onModuleLoad() /*-{
    var registered = @com.googlecode.continuity.plugin.syntaxhighlight.client.HighlightInit::registered = {};
    // register all brushes
    for(var brush in $wnd.dp.sh.Brushes) {
      var aliases = $wnd.dp.sh.Brushes[brush].Aliases;
      if(aliases == null) {
        continue;
      }
      for(var i = 0; i < aliases.length; i++) {
        registered[aliases[i]] = brush;
      }
    }
  }-*/;
}
